import React from 'react'
import { useSearchParams, useLocation } from 'react-router-dom'
export default function Detail() {
    const [search, setSearch] = useSearchParams()
    console.log(search, 'search===')
    const id = search.get('id')
    const title = search.get('title')
    const content = search.get('content')
    console.log(useLocation(), 'useLocation===')//对象中的search属性即可获取到路由的传参
  return (
    <ul>
        <li>
            <button onClick={()=>setSearch('id=007&title=你好&content=world')}>改变，就是好事</button>
        </li>
        <li>{id}</li>
        <li>{title}</li>
        <li>{content}</li>
    </ul>
  )
}
